package JSE_02.List;

import java.sql.SQLOutput;
import java.util.LinkedList;

public class LInkedList {
    public static void main(String[] args){
        show_00();
    }

    public static void show_00(){
        LinkedList<String> linked=new LinkedList<>();
        linked.add("a");
        linked.add("b");
        linked.add("c");
        System.out.println(linked);
        System.out.println("===============");
        linked.addFirst("wwww");
        linked.push("wwww");
        System.out.println(linked);
        System.out.println("=============");
        linked.addLast("baidu");
        System.out.println(linked);
        System.out.println("=============");

//        linked.clear();
//
//        if(!linked.isEmpty()){
//            String first=linked.getFirst();
//            System.out.println(first);
//
//            String last=linked.getLast();
//            System.out.println(last);
//
//            System.out.println("==============");
//
//            System.out.println(linked);
//        }


        String first=linked.getFirst();
        System.out.println(first);

        String last=linked.getLast();
        System.out.println(last);

        System.out.println("==============");

        System.out.println(linked);

        linked.removeFirst();
        System.out.println("===========");
        System.out.println(linked);
        String lastMo=linked.removeLast();
        System.out.println(lastMo);
        System.out.println(linked);

        System.out.println("=============");

        System.out.println("pop移除第一个元素");
        linked.pop();
        System.out.println(linked);
    }
}
